<?php

/**
 * Project: Espolon
 * Licence: BSD License
 * Link: http://espolon.org/
 * Copyright: Nicolas de Bari Embriz Garcia Rojas <nbari at espolon dot org>
 * Author: Nicolas de Bari Embriz Garcia Rojas <nbari at espolon dot org>
 * Version: Beta
 */

if (!defined('SITE_ROOT')) exit('No direct script access allowed');

/**
 * declare the access congtrol objects (roles and perms)
 */
$tpl->assign('accesscontrol', array('perms','roles','users'));
/**
 * based on the options set the active icon
 */
$tpl->assign('active', $options[0]);

/**
 * count roles and users
 */
$tpl->assign('count_roles', $db->GetOne("SELECT count(*) FROM core_roles"));
$tpl->assign('count_users', $db->GetOne("SELECT count(*) FROM core_users"));
/**
 * if no options default to roles
 */
$command = isset($options[0]) ? $options[0] : null;

switch ($command){
  case 'perms':
    $command_tpl = 'perms.tpl';
    $tpl->assign('options',$command);
    require_once 'perms.php';
  break;
  case 'roles':
    $command_tpl = 'roles.tpl';
    $tpl->assign('options',$command);
    require_once 'roles.php';
  break;
  case 'users':
    $command_tpl = 'users.tpl';
    $tpl->assign('options',$command);
    require_once 'users.php';
}

?>